package com.cyx;

import java.util.Scanner;

/**
 * @author 陈裕星
 * @version 1.0
 */
public class 整数转罗马数字 {
    public static void main(String[] args) {
        int values[] = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
        String romans[] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};

        StringBuilder sb = new StringBuilder();

        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        for (int j = 0; j < values.length; j++) {
            while(i >= values[j]){
                sb.append(romans[j]);
                i = i - values[j];
            }
        }
        System.out.println(sb.toString());
    }
}
